class LLIST{T}
****
An implemenation of a linked list. The list has a build in "position" which can be advanced by calling "advance" and reset to the first element by calling "rewind" Elements can be inserted and deleted after the current position using "insert_after", "insert_before" Elements may also be inserted at the head of the list by calling "insert_head" Elements may be deleted by calling "delete" which deletes the current object and advances to the next item This list can be read with elt!.


Flattened version is here



Public


Readable Attributes
attr size: INT;
**** Returns the number of elements stored in the list.

Features
advance
**** Advances the current position.
at_end: BOOL
**** Returns 'true' if the list is empty or the last next reached the end of the list.
at_last: BOOL
**** Returns true, if the current element is the last element.
create: SAME
**** Returns a new linked list.
current: T
**** Returns the current element. Not allowed when at_end is true or list is empty.
dbg_state: STR
delete
**** Deletes the current object. Advances to the next item in the list. Not allowed when no current object available.
delete_all
**** Deletes all elements from the list.
insert_after(t:T)
**** Inserts the item t after the current element. Does not change current.
insert_back(t:T)
**** Insert an element at the end of the list.
insert_before(t:T)
**** Inserts the item t before the current element. Does not change current. This is allowed even if at_end is 'true'.
insert_front(t:T)
**** Insert an element at the beginning of the list.
is_empty: BOOL
**** Returns 'true' if empty.
rewind
**** Sets the current position to the first element;

Iters
elt!: T
**** Yields all elements stored in the list in order. Is re-entrant.


Private

attr first,prev,cur,last: LL_NODE{T};
attr first,prev,cur,last: LL_NODE{T};
attr first,prev,cur,last: LL_NODE{T};
attr first,prev,cur,last: LL_NODE{T};
attr first,prev,cur,last: LL_NODE{T};
attr first,prev,cur,last: LL_NODE{T};
attr first,prev,cur,last: LL_NODE{T};
attr first,prev,cur,last: LL_NODE{T};
attr size: INT;
**** Returns the number of elements stored in the list.

The Sather Home Page